<template>
    <vue-office-pptx :src="fileUrl" style="height: 100%" @rendered="renderedHandler" @error="errorHandler" />
</template>

<script setup>
import { ref, defineProps } from 'vue';
//引入VueOfficeDocx组件
import VueOfficePptx from '@vue-office/pptx';
import $modal from '@/plugins/modal';
const props = defineProps({
    fileUrl: {
        type: [String, ArrayBuffer],
        default: ''
    }
});
$modal.loading();
const fileUrl = props.fileUrl;

const renderedHandler = () => {
    // 加载慢，延迟关闭loading
    setTimeout(() => {
        $modal.closeLoading();
    }, 1200);
};
const errorHandler = (error) => {
    $modal.closeLoading();
};
</script>
<style>
.vue-office-pptx-main {
    height: 100% !important;
}
</style>

